module tb;

reg   clk   ;
reg   resetn;

reg   mem[0:12792];
reg   BS;
integer i;

initial begin 
   $readmemb("bs2.dat", mem);
   //$readmemb("Dsim.dat", mem);
   //$readmemb("Tsim.dat", mem);
end 

initial begin 
   clk = 1'b0;
   forever begin 
     #50us clk = ~clk;
   end 
end 

initial begin 
  resetn = 0;
  BS     = 1'b0;
  i =0;
  #4751us;

  resetn = 1'b1;
  $display("Reset is done.");
  @(posedge clk);
  //repeat (200) begin 
  //i =0;
  repeat(3000) begin 
    //BS = $random();
    BS =  mem[i];
    @(posedge clk);
    i = i+1;
  end 
  //end 

  $finish;

end 


sinc2 DUT(
  .bit_stream(BS    ),
  .clk       (clk   ),
  .resetn    (resetn)
);


integer result;
reg [8*50-1:0] waveform_name;

initial begin 
    waveform_name = "tb.fsdb";
    if ($test$plusargs("DUMP_FILE")) begin 
      result = $value$plusargs("DUMP_FILE=%s", waveform_name);
    end 

    $fsdbDumpfile(waveform_name);
    $fsdbDumpvars(0, tb);
end 

endmodule 
